<?php /*a:1:{s:58:"D:\phpEnv\www\crm\application\crm\view\auth\admin\add.html";i:1670742099;}*/ ?>
<!--
 * @FilePath: \crm\application\crm\view\auth\admin\add.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加用户</title>
    <link rel="stylesheet" href="/static/crm/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/crm/css/public.css" media="all">
    <link rel="stylesheet" href="/static/crm/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
</head>

<body>
    <div class="layuimini-container">
        <form id="app-form" class="layui-form layuimini-form">
            <div class="layui-form-item">
                <label class="layui-form-label">真实姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="realname" class="layui-input" value="<?php echo htmlentities((isset($row['realname']) && ($row['realname'] !== '')?$row['realname']:'')); ?>">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">业务员来源</label>
                <div class="layui-input-block">
                    <input type="radio" name="from" value="0" title="线上推广" <?php if(!empty($row) && $row['from']==0): ?> checked <?php endif; ?>>
                    <input type="radio" name="from" value="1" title="朋友介绍" <?php if(!empty($row) && $row['from']==0): ?> checked <?php endif; ?>>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">是否是课程顾问</label>
                <div class="layui-input-block">
                    <input type="radio" name="is_adviser" value="0" title="否" <?php if(!empty($row) && $row['is_adviser']==0): ?> checked <?php endif; ?>>
                    <input type="radio" name="is_adviser" value="1" title="是" <?php if(!empty($row) && $row['is_adviser']==1): ?> checked <?php endif; ?>>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">校区编码</label>
                <div class="layui-input-block">
                    <input type="text" name="campus_no" class="layui-input" value="<?php echo htmlentities((isset($row['campus_no']) && ($row['campus_no'] !== '')?$row['campus_no']:'')); ?>">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">业务员权限</label>
                <div class="layui-input-block">
                    <?php if(is_array($role) || $role instanceof \think\Collection || $role instanceof \think\Paginator): $i = 0; $__LIST__ = $role;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                    <input type="checkbox" name="role_id[]" lay-skin="primary" title="<?php echo htmlentities($vo['auth_name']); ?>" value="<?php echo htmlentities($vo['id']); ?>"
                        <?php if(!empty($row) && $row['role_id']==$vo['id']): ?>checked<?php endif; ?>>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">用户手机</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" class="layui-input" 
                        value="<?php echo htmlentities((isset($row['phone']) && ($row['phone'] !== '')?$row['phone']:'')); ?>">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">微信号</label>
                <div class="layui-input-block">
                    <input type="text" name="openid" class="layui-input" value="<?php echo htmlentities((isset($row['openid']) && ($row['openid'] !== '')?$row['openid']:'')); ?>">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="gender" value="0" title="男" <?php if(!empty($row) && $row['gender']==0): ?> checked <?php endif; ?>>
                    <input type="radio" name="gender" value="1" title="女" <?php if(!empty($row) && $row['gender']==1): ?> checked <?php endif; ?>>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">银行卡号</label>
                <div class="layui-input-block">
                    <input type="text" name="bank_card" class="layui-input" value="<?php echo htmlentities((isset($row['bank_card']) && ($row['bank_card'] !== '')?$row['bank_card']:'')); ?>">
                </div>
            </div>

            <div class="layui-form-item text-center" style="padding-left:45%;">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit
                    lay-filter="admin-add">确认</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
            </div>
        </form>
    </div>
    <script src="/static/crm/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'jquery', 'layer'], function () {
            var $ = layui.jquery,
                form = layui.form,
                layer = layui.layer;

            form.on('submit(admin-add)', function (data) {
                $.ajax({
                    type: 'post',
                    url: "/crm/auth.admin/<?php echo isset($edit) ? htmlentities($edit) : 'add'; ?>/account/<?php echo htmlentities((isset($row['account']) && ($row['account'] !== '')?$row['account']:'')); ?>",
                    dataType: 'json',
                    data: data.field,
                    success: function (result) {
                        if (result.code == 1) {
                            layer.msg(result.msg, {
                                time: 800,
                                end: function () {
                                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                                    parent.layer.close(iframeIndex);
                                }
                            });
                        } else {
                            layer.msg(result.msg);
                        }
                    }
                })
                return false;
            });
        });
    </script>
</body>

</html>